<?php
	
	/**
	 * Verifies bootstrapper execution to ensure file
	 * necessities, and disabling direct access
	 */
	defined('ENGINE') or exit;
	
	/**
	 * Email validation, check if a supplied email 
	 * is written with a correct syntax.
	 */
	function is_valid_email($email = NULL)
	{
		$email = (string) $email;
		
		if(!is_null($email))
		{
			if(extension_loaded('filter'))
			{
				return((boolean) filter_var($email, FILTER_VALIDATE_EMAIL));
			}
			
			if(preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/', $email))
			{
				/** This function is only available on Windows platforms as of PHP 5.3.0 **/
				if(!function_exists('checkdnsrr'))
				{
					return(true);
				}
				else
				{
					if(checkdnsrr(array_pop(explode('@',$email)), 'ANY'))
					{
						return(true);
					}
				}
			}
		}
		
		return(false);
	}

?>